Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor #57

Merged
merged 20 commits into from Jan 14, 2013
Merged

Refactor #57

merged 20 commits into from Jan 14, 2013

Conversation

fb55
Copy link

@fb55 fb55 commented Sep 8, 2012

As you might have seen, I did some refactoring in the refactor branch. Mainly removing unused code, improving and abstracting some stuff and introducing two new public methods:

  • analyzer.path does ra's magic on a path, no matter what kind of file is behind it.
  • analyzer.findNextDir does what .findModulesDir did so long: Return the next directory for a path.

.findModulesDir now actually searches for a directory containing either a node_modules dir or a package.json file.

findit is no longer a dependency, as .path (which is an abstraction of .dir) can do the job.

Please have a look at the code, it's possible that I've missed something. (All tests pass at least.)

also fixed some linting errors (semicolons & equals)
…a path

as it's mainly the code of .analyze, use it there
• use the `in` operator more frequently (it's much nicer than `typeof
foo !== "undefined"` + is more readable)
• removed some garbage
• added some comments
in L54, err would have always be falsey (or the function had returned
earlier)
also moved the creation of the find-dependencies path to the
surrounding scope
this is the functionality that is described in the comments, but wasn't
implemented (yet)
a folder should never contain a file that has the folder's path as it's
name
the last change broke most tests, so .findNextDir is what's actually
wanted for .npmAnalyze
we don't use more, so don't do anything fancy
• removed scanning scripts as they weren't implemented properly (they
just looped a couple of times without doing anything)
• simplified signature of mergeDependencies
• return errors in .package
• also updated some comments
@indexzero
Copy link
Member

@mmalecki @AvianFlu We should look at this in the next week or two to evaluate it. No rush though.

if (!options || !options.target) {
//
// If there are no `options` and no `options.target` property
// respond with the appropriate error.
//
callback(new Error('options and options.target are required'));
return emitter;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs review. Is this depended upon anywhere?

Guessing not, as in the error we don't return any ee.

@dscape
Copy link

dscape commented Dec 28, 2012

LGTM. Seems like great work by @fb55

Tests pass locally

yawnt added a commit that referenced this pull request Jan 14, 2013
@yawnt yawnt merged commit 6ece1ff into master Jan 14, 2013
@fb55 fb55 deleted the refactor branch January 14, 2013 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants